var sdc = require('sdc-clients'),dc_config=require('../config/dc')['poc'],imgapi = new sdc.IMGAPI(dc_config.imgapi)
module.exports = {
	listImages:function (req, res, next) {
		imgapi.listImages({state: 'active'//,public: true
		}, function (err, obj) {
			if(err){
				console.log(err)
				if(err.body&&err.body.errors)
					for(var i in err.body.errors)
						console.log(err.body.errors[i])
			}else req.images=obj
			next()
        })
	},
	get:function(req, res, next){
		imgapi.getImage(req.params.uuid, function (err, image, getImagesRes) {
			if (err) {
				return next(err);
			} else {
				req.image=image
				return next();
			}
		});
	}
}